package cn.erperp.cdc.maxwell.config;

import cn.erperp.cdc.maxwell.properties.CommonConfig;
import com.aliyun.mns.client.CloudAccount;
import com.aliyun.mns.client.MNSClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class MnsConfig {


    @Autowired
    CommonConfig commonConfig;

    /**
     * 初始化mns 客户端
     * @return
     */
    @Bean
    public MNSClient mnsClient() {
        CloudAccount account = new CloudAccount(commonConfig.getAccessKeyId(), commonConfig.getAccessKeySecret(),commonConfig.getMnsEndpoint());
        MNSClient client = account.getMNSClient();
        log.info("init msnClient");
        return client;
    }
}
